package com.schoolMall.dto;

import com.schoolMall.domain.Shop;
import com.schoolMall.enums.ShopStateEnum;
import jdk.jfr.Description;

import java.util.List;

/**
 * @author:zyh
 * @Time:2021-08-29-14:51
 * @email:1269231889@qq.com
 */
public class ShopDto {
    @Description(value = "修改或更新店铺")
    private Shop shop;

    @Description(value = "操作状态标识")
    private int code;

    @Description(value = "操作信息")
    private String msg;

    @Description(value = "店铺数量")
    private int shopNum;

    @Description(value = "查询店铺数量")
    private List<Shop> shopList;

    public ShopDto() {
    }

    /**
     * 失败构造器，不返回shop
     *
     * @param shopStateEnum
     */
    public ShopDto(ShopStateEnum shopStateEnum) {
        this.code = shopStateEnum.getState();
        this.msg = shopStateEnum.getDesc();
    }


    /**
     * 店铺操作成功返回的构造器
     *
     * @param shopStateEnum
     * @param shop
     */
    public ShopDto(ShopStateEnum shopStateEnum, Shop shop) {
        this.code = shopStateEnum.getState();
        this.msg = shopStateEnum.getDesc();
        this.shop = shop;
    }

    /**
     * 返回查询到所有shop的list
     *
     * @param shopStateEnum
     * @param shopList
     */
    public ShopDto(ShopStateEnum shopStateEnum, List<Shop> shopList) {
        this.code = shopStateEnum.getState();
        this.msg = shopStateEnum.getDesc();
        this.shopList = shopList;
    }

    public Shop getShop() {
        return shop;
    }

    public void setShop(Shop shop) {
        this.shop = shop;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public int getShopNum() {
        return shopNum;
    }

    public void setShopNum(int shopNum) {
        this.shopNum = shopNum;
    }

    public List<Shop> getShopList() {
        return shopList;
    }

    public void setShopList(List<Shop> shopList) {
        this.shopList = shopList;
    }
}
